package kr.hyunist.androidcomplete01saeildamil.ch07;

import kr.hyunist.androidcomplete01saeildamil.*;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;

public class VibratorTest extends Activity {
	Vibrator mVib;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.vibratortest);

		mVib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		mVib.cancel();
	}

	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.vibratorbtn1:
			mVib.vibrate(500);
			break;
			
		case R.id.vibratorbtn2:
			mVib.vibrate(new long[] {100, 50, 200, 50}, 0);
			break;
			
		case R.id.vibratorbtn3:
			mVib.cancel();
			break;
		}
	}

}
